Reflection

  • Allows runtime inspection of types and assemblies.

  • Example:

Type t = typeof(String);
foreach (var method in t.GetMethods())
{
    Console.WriteLine(method.Name);
}
  • Uses:

    • serializers

    • dependency injection

    • plugin systems

    • editors (Unity inspector)

  • Reflection is slower than direct code.